package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Order;
import com.itheima.reggie.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
public class OrderController {
    @Autowired
    private OrderService orderService;
    @PostMapping("/order/submit")
    public ResultInfo saveOrder(@RequestBody Order order){
        orderService.saveOrder(order);
        return ResultInfo.success(null);
    }
    @GetMapping("order/userPage")
    public ResultInfo findHistoryOrders(@RequestParam(value = "page") Integer pageNum, Integer pageSize){

        return ResultInfo.success(orderService.findHistoryOrders(pageNum,pageSize));
    }

}
